<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
        div {
            width: 1210px;
            margin: 200px auto;
            color: red;
            text-align: center;
            font: 600 30px/30px "simsun";
        }
    </style>
	</head>
	<body>
		<div>
		</div>
	</body>
	<script>
		var div=document.getElementsByTagName("div")[0]
		setInterval(fn,1);
		function fn(){
			var nowtime=new Date();
			var future=new Date("2024/08/19 21:30:00")
			var timeSum=future.getTime()-nowtime.getTime()
			var day=parseInt(timeSum/1000/60/60/24)
			var hour=parseInt(timeSum/1000/60/60%24)
			var minu=parseInt(timeSum/1000/60%60)
			var nmi=minu.toString()
			var sec=parseInt(timeSum/1000%60)
			var ns=sec.toString()
			var milsec=parseInt(timeSum%1000)
			var nm=milsec.toString()
			if(nmi.length==1){
				nmi="0"+nmi;
			}
			if(ns.length==1){
				ns="0"+ns;
			}
			if(nm.length<2){
				nm="0"+"0"+nm;
				
			}else if(nm.length==2){
				nm="0"+nm;
				
			}
			div.innerHTML="距离下课吃饭还有"+day+"天"+hour+"小时"+nmi+"分"+ns+"秒"+nm+"毫秒"
		}
		
	</script>
</html>
